package com.ruoyi.task;

import com.ruoyi.service.MineLtcdjcService;
import com.ruoyi.service.SlopeMonitorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class GeneratingTextTask {
    @Autowired
    private SlopeMonitorService slopeMonitorService;
    @Autowired
    private MineLtcdjcService mineLtcdjcService;

//    @Scheduled(cron = "0/5 * * * * ?")
//    public void executeTask() {
//        System.out.println("定时发送" + LocalDateTime.now());
//      //  slopeMonitorService.slopeMonitorcreateTxt();
//
//    }

    @Scheduled(cron = "0 10/20 * * * ?  ")
    public void SlopeMonitorcreateTxt() {
        LocalDateTime now = LocalDateTime.now();
        log.info("定时任务开始生成实时数据: {}", LocalDateTime.now());
        slopeMonitorService.slopeMonitorcreateTxt();

    }

    @Scheduled(cron = "0 5 7 * * ? ")
    public void orderStatusComplete() {
        LocalDateTime now = LocalDateTime.now();
        log.info("定时任务开始生成基本数据: {}", LocalDateTime.now());
        mineLtcdjcService.mineLtcdjcCreateTxt();


    }
//    @Scheduled(cron = "0 10 20 * * ? ")
//    public void orderStatusCompletes() {
//        LocalDateTime now = LocalDateTime.now();
//        log.info("定时任务开始生成基本数据: {}", LocalDateTime.now());
//        mineLtcdjcService.mineLtcdjcCreateTxt();
//
//
//    }

    @Scheduled(cron = "0 10 1 * 1/3 ?  ")
    public void sysCoalDlete() {
        LocalDateTime now = LocalDateTime.now();
        log.info("定时清除缓存数据: {}", LocalDateTime.now());
       slopeMonitorService.deleteMachine();
    }
}